#ifndef _CPLAYER_H_
#define _CPLAYER_H_

#include "CBase.h"
#include "..\SGD_Math.h"

class CPlayer : public CBase
{
private:
	CPlayer(void);
	CPlayer(const CPlayer&);
	CPlayer& operator=(const CPlayer&);
	~CPlayer(void);

	float speedFactor; // factor used to increase or decrease the speed of the player (0.0f is standard speed)
	float moneyFactor; // factor used to increase or decrease the amount of money the player gets from killing enemies
	float m_fFireTimer; // Keep player from shooting too fast
	float m_fShotTimer;
	float m_fRocketTimer;

	// is the screen flashing
	bool m_bIsFlashing;
	// flash timer
	float m_fFlashTimer;

	int health;
	int MaxHealth;
	int money;	// the amount of money that the player has
	// Ammo variables
	int m_nPistolAmmo;
	int m_nShotgunAmmo;
	int m_nRocketAmmo;
	int m_nExGrenades;
	int m_nFWGrenades;

	// Clip Sizes
	int m_nPistolClip;
	int m_nShotgunClip;
	int m_nRocketClip;
	int m_nExGrenadeClip;
	int m_nFWGrenadeClip;

	// Asset IDs
	int m_nPistolID;
	int m_nShotgunID;
	int m_nRocketID;
	int m_nEmptyID;
	int m_nThrowID;

	int CursorID;

	tVector2D m_tStartPos;
	tVector2D m_tToMouse;

	// Assed IDs
	//int animationID;
	int DownAnimationID;
	int UpAnimationID;
	int LeftAnimationID;
	int RightAnimationID;

	// Upgrades
	bool m_bSpeedActive;
	bool m_bFireRateActive;
//Animations
	int PistolShootDownAnimID;
	int PistolShootLeftAnimID;
	int PistolShootUpAnimID;

	int ShotgunShootDownAnimID;
	int ShotgunShootLeftAnimID;
	int ShotgunShootUpAnimID;

	int RocketShootDownAnimID;
	int RocketShootLeftAnimID;
	int RocketShootUpAnimID;

	float m_fCurrRotRight, m_fCurrRotLeft, m_fCurrRotUp, m_fCurrRotDown;

public:
	static CPlayer* GetInstance(void);

	void Update(float fElapsedTime);
	void Render(void);

	float GetMoneyFactor() {return moneyFactor;}
	void SetMoneyFactor(float mf) {moneyFactor = mf;}
	float GetSpeedFactor() {return speedFactor;}
	void SetSpeedFactor(float sf) {speedFactor = sf;}
	void SetMoney(int cash) {money = cash;}
	int GetMoney() {return money;}
	int gethealth();
	void sethealth(int h);

	int GetMaxHealth() {return MaxHealth;}
	void SetMaxHealth(int maxHealth){MaxHealth = maxHealth;}

	
	void SetRotationR(float fCurrRotR)	{m_fCurrRotRight = fCurrRotR;}
	void SetRotationL(float fCurrRotL)	{m_fCurrRotLeft = fCurrRotL;}
	void SetRotationU(float fCurrRotU)	{m_fCurrRotUp = fCurrRotU;}
	void SetRotationD(float fCurrRotD)	{m_fCurrRotDown = fCurrRotD;}
	tVector2D GetPosVector() { return m_tStartPos; }
	tVector2D GetMouseVector() { return m_tToMouse; }

	int GetPistolAmmo() { return m_nPistolAmmo; }
	void SetPistolAmmo(int nAmmo) 
	{ 
		m_nPistolAmmo = nAmmo; 
		if(m_nPistolAmmo >= m_nPistolClip*20)
			m_nPistolAmmo = m_nPistolClip*20;
	}
	int GetShotgunAmmo() { return m_nShotgunAmmo; }
	void SetShotgunAmmo(int nAmmo) 
	{ 
		m_nShotgunAmmo = nAmmo; 
		if(m_nShotgunAmmo >= m_nShotgunClip*5)
			m_nShotgunAmmo = m_nShotgunClip*5;
	}
	int GetRocketAmmo() { return m_nRocketAmmo; }
	void SetRocketAmmo(int nAmmo) 
	{ 
		m_nRocketAmmo = nAmmo; 
		if(m_nRocketAmmo >= m_nRocketClip*2)
			m_nRocketAmmo = m_nRocketClip*2;
	}
	int GetExGrenades() { return m_nExGrenades; }
	void SetExGrenades(int nGren) 
	{ 
		m_nExGrenades = nGren;
		if(m_nExGrenades >= m_nExGrenadeClip*3)
			m_nExGrenades = m_nExGrenadeClip*3;
	}
	int GetFwGrenades() { return m_nFWGrenades; }
	void SetFwGrenades(int nGren) 
	{ 
		m_nFWGrenades = nGren;
		if(m_nFWGrenades >= m_nFWGrenadeClip*2)
			m_nFWGrenades = m_nFWGrenadeClip*2;
	}
	int GetPistolClip() {return m_nPistolClip;}
	void SetPistolClip(int rank) {m_nPistolClip = rank;}
	int GetShotgunClip() {return m_nShotgunClip;}
	void SetShotgunClip(int rank) {m_nShotgunClip = rank;}
	int GetRocketClip() {return m_nRocketClip;}
	void SetRocketClip(int rank) {m_nRocketClip = rank;}
	int GetExGrenadeClip() {return m_nExGrenadeClip;}
	void SetExGrenadeClip(int rank) {m_nExGrenadeClip = rank;}
	int GetFWGrenadeClip() {return m_nFWGrenadeClip;}
	void SetFWGrenadeClip(int rank) {m_nFWGrenadeClip = rank;}

	// Upgrades
	bool GetSpeedActive() { return m_bSpeedActive; }
	bool GetFireRateActive() { return m_bFireRateActive; }
	void SetSpeedActive(bool bActive) { m_bSpeedActive = bActive; }
	void SetFRActive(bool bActive) { m_bFireRateActive = bActive; }


	RECT GetCollisionRect(void);

	bool CheckCollisions(IBaseInterface* IBase);
};

#endif